Skip to main content
The Docker images listed in this repository (ghcr.io/ggerganov/llama.cpp:*) are inherited from the upstream llama.cpp fork and have never been updated for ik_llama.cpp. They are outdated and will not include ik_llama.cpp-specific features, quantisation types, or performance improvements. Build your own image from the Dockerfiles in .devops/ to get ik_llama.cpp functionality.
The recommended path for containerised deployment is to use the community-maintained Containerfiles bundled in the docker/ directory of this repository, which include llama-swap for model management and support both CPU and CUDA targets.

Community build: llama-swap + Podman/Docker

The docker/ directory contains ready-to-use Containerfiles and llama-swap config files for CPU and CUDA:
Download those four files to a local directory (for example ~/ik_llama/), then follow the steps below.

Building

The build produces two image tags:
  • swap — includes llama-swap and llama-server only (recommended for serving)
  • full — additionally includes llama-quantize, llama-sweep-bench, llama-perplexity, and other utilities

Running

Map your model directory to /models inside the container. The web UI is available at http://localhost:9292 and the OpenAI-compatible API at http://localhost:9292/v1.
To run in the background, replace -it with -d. Stop the container with podman stop ik_llama or docker stop ik_llama.

Building your own image from .devops/

If you need more control, you can build directly from the upstream-inherited Dockerfiles in .devops/:
The default build args are CUDA_VERSION=11.7.1 and CUDA_DOCKER_ARCH=all. Override them to match your environment:

Running with GPU passthrough

Requires nvidia-container-toolkit installed on the host.
Pass --n-gpu-layers 999 (or -ngl 999) to offload the entire model to VRAM. See the performance tips page for guidance on choosing the right value.

GPU selection

Use the CUDA_VISIBLE_DEVICES environment variable to restrict which GPUs the container uses:

Pinning to a specific commit

To build a community image from a specific ik_llama.cpp commit, pass CUSTOM_COMMIT:

Troubleshooting

Make sure the NVIDIA Container Toolkit (Docker) or CDI (Podman) is installed and the host drivers match the CUDA version baked into the image. If CUDA is unavailable, fall back to the ik_llama-cpu image.
Verify the host path in your -v flag points to the directory that actually contains your .gguf files. Inside the container the path must be /models.
The Containerfiles default to -DGGML_NATIVE=ON, which optimises for the build machine’s CPU. If you are building on a different machine from where you will run the container, change that flag to -DGGML_NATIVE=OFF in the Containerfile before building.
List images with docker image ls and remove unused base images such as docker.io/nvidia/cuda:12.4.0-devel-ubuntu22.04 with docker image rm.